import { createRouter, createWebHistory } from 'vue-router'
import HomeworkPage from '../views/HomeworkPage.vue'
import ClassContent from "@/views/class/classContent.vue"
import UserSetting from "@/views/userSetting/userSetting.vue"
import ClassIntroduction from "@/views/class/classIntroduction/classIntroduction.vue";
import ClassShow from "@/views/class/classShow/classShow.vue";

import addClass from "@/components/class/addClass.vue";
import pigeonholeClass from "@/components/class/pigeonholeClass.vue";
import HomePage from '../views/HomePage.vue' 
import CreateUser from '../views/createUser/CreateUser.vue'
import UserLogin from '../views/login/LoginPage.vue'
import StudentPage from '../views/student/StudentPage.vue'
import MainPage from '../views/main/MainPage.vue'
import TeacherPage from '../views/teacher/TeacherPage.vue' 
import CourseSetPage from "../views/courseSetting/CourseSetPage.vue";
import MemberPage from "../views/member/MemberPage.vue";
const router = createRouter({
  history: createWebHistory(),
  routes: [
    {
      path: '/',
      redirect: '/home'  // 改为重定向到 homePage
    },
    {
      path: '/homePage',     // 添加不带 id 的路由
      name: 'HomeworkList',
      component: HomeworkPage
    },
    {
      path: '/homePage/:id',
      name: 'Homework',
      component: HomeworkPage
    },
    {
      path: '/classContent',
      component: ClassContent,
      meta: {
        requireAuth: true,
      }
    },
    {
      path:'/test',
      component: pigeonholeClass
    },
    {
      path: '/classDetail/classIntroduction',
      name: 'classIntroduction',
      component: ClassIntroduction,
      meta: {
        requireAuth: true,
      }
    },
    {
      path: '/classDetail/classPerformance',
      name: 'classShow',
      component: ClassShow,
      meta: {
        requireAuth: true,
      }
    },
    {
      path:'/class',
      name:'addClass',
      component:addClass,
      meta: {
        requireAuth: true,
      }
    },
    {
      path: '/userSetting',
      component: UserSetting,
      meta: {
        requireAuth: true,
      }
    },
    {
    path: "/home",
    name: "HomePage",
    component: HomePage,
  },
    // 登录页面
  {
    path: "/login",
    name: "UserLogin",
    component: UserLogin,
  },
  //注册页面
  {
    path: "/register",
    name: "CreateUser",
    component: CreateUser,
  },
  //首页
  {
    path: "/main",
    name: "MainPage",
    component: MainPage,
  },
  //学生首页
  {
    path: "/studentPage",
    name: "StudentPage",
    component: StudentPage,
  },
  //老师首页
  {
    path: "/teacherPage",
    name: "TeacherPage",
    component: TeacherPage,
  },
  {
    path: "/homePage", // 添加不带 id 的路由
    name: "HomeworkList",
    component: HomeworkPage,
  },
  {
    path: "/homePage/:id",
    name: "Homework",
    component: HomeworkPage,
  },
  {
    path: "/classSetting",
    name: "CourseSetPage",
    component:CourseSetPage
  },
  {
    path: "/member",
    name: "MemberPage",
    component:MemberPage
  }
  ]
})

export default router
